package unit3_1013.test3;

/*
 * 宠物类--父类---Dog,Cat
 * 两个类均有属性：昵称name，健康值health，性别sex.
 * 在Java里,任何类都是Object 的子类.
 */
public class Pet{
	
	private String name;
	private int health;
	private String sex;
	
	
	
	protected String getName() {
		return name;
	}
	protected void setName(String name) {
		this.name = name;
	}
	protected int getHealth() {
		return health;
	}
	protected void setHealth(int health) {
		if(health<1 || health>100) {
			health=60;
		}
		this.health = health;
	}
	protected String getSex() {
		return sex;
	}
	protected void setSex(String sex) {
		this.sex = sex;
	}
	public Pet(String name, int health, String sex) {
		super();//默认调用父类的无参构造方法
		this.name = name;
		this.health = health;
		this.sex = sex;
	}
	public Pet() {
		System.out.println("父类Pet的对象产生了...");
	}
	
	public void show() {
		
	}

	
	public static void haha() {
		
	}
	private void xixi() {
		
	}
	
	
	public void test() throws NullPointerException{
		
	}
	
}

